import com.project.MyBatisConfig;
import com.project.bean.*;
import com.project.mapper.storeMapper.IStoreMapper;
import com.project.service.addressService.IAddressService;
import com.project.service.employeeService.IEmployeeService;
import com.project.service.goodsOrderService.IGoodsOrderService;
import com.project.service.goodsService.IGoodsService;
import com.project.service.managerService.IManagerService;
import com.project.service.petInfoService.IPetInfoService;
import com.project.service.reviewService.IReviewService;
import com.project.service.sellCountService.ISellCountService;
import com.project.service.serveOrderService.IServeOrderService;
import com.project.service.serveService.IServeService;
import com.project.service.storeService.IStoreService;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

import java.math.*;
import java.text.DecimalFormat;
import java.time.LocalDate;

@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(classes = MyBatisConfig.class)
public class test {
    @Autowired
    private IEmployeeService employeeService;
    @Autowired
    private IManagerService managerService;
    @Autowired
    private IStoreService storeService;
    @Autowired
    private IServeService serveService;
    @Autowired
    private IServeOrderService serveOrderService;
    @Autowired
    private ISellCountService sellCountService;
    @Autowired
    private IAddressService addressService;
    @Autowired
    private IGoodsService goodsService;
    @Autowired
    private IGoodsOrderService goodsOrderService;
    @Autowired
    private IPetInfoService petInfoService;
    @Autowired
    private IReviewService reviewService;

    @Test
    public void test1(){
//        employeeService.add(new EmployeeBean("王昌","男", LocalDate.parse("1998-05-24"),"15983514521","修毛",1));
//        employeeService.del(3);
//        employeeService.update(1, "13541168386", "打针");
//        employeeService.updateState(2, "服务中");
//        System.out.println(employeeService.findById(1));
//        System.out.println(employeeService.findByState(1));
//        System.out.println(employeeService.findBySkill(1,"毛", 1));
//        System.out.println(employeeService.findAll(1, 1));

//        System.out.println(managerService.login("tom", "111"));
//        managerService.add(new ManagerBean("huhu","13565412365","009@111.com","霍建华","8.jpg",1));
//        System.out.println(managerService.findById(1));
//        System.out.println(managerService.findByItem(3, null, "已申请门店"));
//        System.out.println(managerService.findAll(1));

//        storeService.add(new StoreBean("宠物机密","007","7.jpg","黄山寺","成都","15982371685","鬼脚七",8));
//        System.out.println(storeService.findById(1));
//        System.out.println(storeService.findByItem(1, null, "已审核"));
//        storeService.updateApply(2, "该商店达标", "已审核");
//        storeService.updateBusiness(2, "已关闭");
//        System.out.println(storeService.findAll(1));

//        serveService.add(new ServeBean("宠物修毛","12:00-15:00","小型犬、大型犬、小型猫、大型猫","精修",100,"3.jpg",2));
//        serveService.del(2);
//        serveService.update(1, "09:00-12:00", 25);
//        System.out.println(serveService.findById(1));
//        System.out.println(serveService.findAll(1, 1));
//        System.out.println(serveService.findByName(1, "毛", 1));

//        serveOrderService.add(new ServeOrderBean("2021-1-28 09:00-10:00","刘英","13541178965","万圣社区",1,1));
//        System.out.println(serveOrderService.findById(1));
//        serveOrderService.update(10, "执行中");
//        System.out.println(serveOrderService.findAll(1, 1));
//        System.out.println(serveOrderService.findByItem("未完成",LocalDate.parse("2020-12-23"),LocalDate.parse("2021-02-01"),1));

//        System.out.println(sellCountService.findAllServeByYear("2020"));
//        System.out.println(sellCountService.findAllServeByCity("2021"));
//        System.out.println(sellCountService.findServeNumByType("2020", "7", 1));
//        System.out.println(sellCountService.findGoodsNumByType("2021", "1", 1));
//        System.out.println(sellCountService.findAllGoodsByYear("2021"));
//        System.out.println(sellCountService.findAllGoodsByCity("2021"));

//        addressService.findAll(1, 1);
//        addressService.add(new AddressBean("华顺","15913541168","方元街55号",1));
//        addressService.del(10);
//        addressService.update(1, "肖倩","13515918200" );

//        System.out.println(goodsService.findByItem(1, "猫", "猫粮", null, 1));
//        System.out.println(goodsService.findByName(1, "猫","猫粮",null,"宠" ));
//        System.out.println(goodsService.findById(1));
//        goodsService.add(new GoodsBean("好又来狗狗饼干","狗粮","烘焙","成犬，幼犬","5kg/袋","充饥","中国",LocalDate.parse("2020-11-13"),"正常",180,159,"14.jpg",1));
//        goodsService.del(1);
//        goodsService.update(1, 139);

//        goodsOrderService.findAll(1, 1);
//        System.out.println(goodsOrderService.findById(1));

        reviewService.addGoodsReview(new ReviewBean("味道有点惹怪哦","郭靖",4.8,LocalDate.parse("2021-01-31"),1,1), 1);
//        System.out.println(reviewService.findByGoodsId(1));
//        System.out.println(reviewService.findByServeId(1));

//        petInfoService.findByItem(1,"");

//        double n = 12.9998;
//        BigDecimal b = new BigDecimal(n);
//        double f = b.setScale(2,BigDecimal.ROUND_DOWN).doubleValue();
//        System.out.println(f);


    }
}
